package com.ruoyi.web.controller.combat.useralignment;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.combat.domain.useralignment.CombatAlignmentTask;
import com.ruoyi.combat.service.useralignment.ICombatAlignmentTaskService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 身份对齐任务Controller
 * 
 * @author ruoyi
 * @date 2025-03-25
 */
@RestController
@RequestMapping("/combat/alignmentTask")
@Api(tags = "身份对齐任务管理")
public class CombatAlignmentTaskController extends BaseController
{
    @Autowired
    private ICombatAlignmentTaskService combatAlignmentTaskService;

    /**
     * 查询身份对齐任务列表
     */
    @PreAuthorize("@ss.hasPermi('combat:alignmentTask:list')")
    @GetMapping("/list")
    @ApiOperation("查询身份对齐任务列表")
    public TableDataInfo list(CombatAlignmentTask combatAlignmentTask)
    {
        startPage();
        List<CombatAlignmentTask> list = combatAlignmentTaskService.selectCombatAlignmentTaskList(combatAlignmentTask);
        return getDataTable(list);
    }

    /**
     * 导出身份对齐任务列表
     */
    @PreAuthorize("@ss.hasPermi('combat:alignmentTask:export')")
    @Log(title = "身份对齐任务", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, CombatAlignmentTask combatAlignmentTask)
    {
        List<CombatAlignmentTask> list = combatAlignmentTaskService.selectCombatAlignmentTaskList(combatAlignmentTask);
        ExcelUtil<CombatAlignmentTask> util = new ExcelUtil<CombatAlignmentTask>(CombatAlignmentTask.class);
        util.exportExcel(response, list, "身份对齐任务数据");
    }

    /**
     * 获取身份对齐任务详细信息
     */
    @PreAuthorize("@ss.hasPermi('combat:alignmentTask:query')")
    @GetMapping(value = "/{id}")
    @ApiOperation("获取身份对齐任务详细信息")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(combatAlignmentTaskService.selectCombatAlignmentTaskById(id));
    }

    /**
     * 新增身份对齐任务
     */
    @PreAuthorize("@ss.hasPermi('combat:alignmentTask:add')")
    @Log(title = "身份对齐任务", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody CombatAlignmentTask combatAlignmentTask)
    {
        return toAjax(combatAlignmentTaskService.insertCombatAlignmentTask(combatAlignmentTask));
    }

    /**
     * 修改身份对齐任务
     */
    @PreAuthorize("@ss.hasPermi('combat:alignmentTask:edit')")
    @Log(title = "身份对齐任务", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody CombatAlignmentTask combatAlignmentTask)
    {
        return toAjax(combatAlignmentTaskService.updateCombatAlignmentTask(combatAlignmentTask));
    }

    /**
     * 删除身份对齐任务
     */
    @PreAuthorize("@ss.hasPermi('combat:alignmentTask:remove')")
    @Log(title = "身份对齐任务", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    @ApiOperation("删除身份对齐任务")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(combatAlignmentTaskService.deleteCombatAlignmentTaskByIds(ids));
    }

    /**
     * 抗识别
     * @return
     */
    @ApiOperation("抗识别")
    @GetMapping("/AntiRecognition")
    public AjaxResult AntiRecognition(@RequestParam("warnId") String warnId, @RequestParam("methodId")String methodId){
        combatAlignmentTaskService.AntiRecognition(warnId, methodId);
        return success();
    }


}
